﻿@model Marbale.BusinessObject.SiteSetup.User

@{
    ViewBag.Title = "User";
    Layout = null;
}
<div class="modal-header">
    @if (Model.Id > 0)
    {
        <h4 class="modal-title">Edit User</h4>
    }
    else
    {
        <h4 class="modal-title">New User</h4>
    }
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="min-width: 10px !important;">&times;</button>
</div>
<div class="modal-body">
    @using (Ajax.BeginForm("AddOrEditUser", "SiteSetup", FormMethod.Post, new AjaxOptions { OnSuccess = "displayMessage" }))
    {
        <div id="editpopup" style="height: 500px">
            <form>
                <div id="productclass" style="border: 2px solid black; border-color: cornsilk">
                    <div class="row">
                        <div class="col-md-6">
                            <label for="ex1" class="col-md-5"><b>Id:</b></label>
                            @Html.TextBoxFor(m => m.Id, new { @readonly = "readonly", @class = "col-md-6" })
                        </div>
                        <div class="col-md-6">
                            <label for="ex2" class="col-md-5"><b>Name:</b></label>
                            @Html.TextBoxFor(m => m.Name, new { @class = "col-md-6", placeholder = @Html.DisplayNameFor(n => n.Name) })
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6">
                            <label for="ex2" class="col-md-5"><b>LoginId:</b></label>
                            @Html.TextBoxFor(m => m.LoginId, new { @class = "col-md-6", placeholder = @Html.DisplayNameFor(n => n.LoginId) })
                        </div>

                        <div class="col-md-6">
                            <label for="ex2" class="col-md-5"><b>Email:</b></label>
                            @Html.TextBoxFor(m => m.Email, new { @class = "col-md-6", placeholder = @Html.DisplayNameFor(n => n.Email) })
                        </div>
                    </div>


                    <div class="row">
                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>Manager:</b></label>
                            @Html.TextBoxFor(m => m.Manager, new { @class = "col-md-6" })
                        </div>
                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>Department:</b></label>
                            @Html.TextBoxFor(m => m.Department, new { @class = "col-md-6" })
                        </div>

                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>Status:</b></label>
                            <select name="categoryList" id="categoryList" class="col-md-6">
                                @foreach (var status in Model.Statuses)
                                {
                                    <option value="@status.Value">@status.Value</option>
                                }
                            </select>
                        </div>
                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>Admin</b></label>
                            @Html.CheckBoxFor(m => m.CompanyAdmin, new { @class = "col-md-6", @style = "position:absolute;width:20px;" })
                        </div>
                    </div>
                </div>
                <div class="pricediv" style="border: 2px solid black; border-color: cornsilk">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="col-md-13">
                                <label for="ex4" class="col-md-5"><b>Role:</b></label>
                                <select name="Roles" id="Roles" class="col-md-6">
                                    @foreach (var role in Model.Roles)
                                    {
                                        <option value="@role.Value">@role.Value</option>
                                    }
                                </select>
                            </div>
                        </div>

                        <div class="col-md-4">
                            <label for="ex4" class="col-md-5"><b>POS Counter:</b></label>
                            @Html.TextBoxFor(m => m.POSCounter, new { @class = "col-md-6" })
                        </div>
                        <div class="col-md-4">
                            <label for="ex4" class="col-md-5"><b>Invalid Attempts</b></label>
                            @Html.TextBoxFor(m => m.InvalidAttempts, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>

                    </div>
                </div>
                <b style="color: cadetblue">Date Time</b>
                <div class="Entitlement" style="border: 2px solid black; border-color: cornsilk">
                    <div class="row">

                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>Employment Start Date:</b></label>
                            @Html.TextBoxFor(m => m.EmpStartDate, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>

                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>Employment End Date:</b></label>
                            @Html.TextBoxFor(m => m.EmpEndDate, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>
                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>Employment End Reason:</b></label>
                            @Html.TextBoxFor(m => m.EmpEndReason, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>

                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>LastLoginTime:</b></label>
                            @Html.TextBoxFor(m => m.LastLoginTime, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })

                        </div>
                        <div class="col-md-6">
                            <label for="ex1" class="col-md-5"><b>LastLogoutTime:</b></label>
                            @Html.TextBoxFor(m => m.LastLogoutTime, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>

                    </div>
                </div>
                <div class="Miscellaneousclass" style="border: 2px solid black; border-color: cornsilk">
                    <div class="row">
                        <div class="col-md-6">
                            <label for="ex2" class="col-md-5"><b>CreatedBy:</b></label>
                            @Html.TextBoxFor(m => m.CreatedBy, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>
                        <div class="col-md-6">
                            <label for="ex2" class="col-md-5"><b>CreationDate:</b></label>
                            @Html.TextBoxFor(m => m.CreationDate, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>
                        <div class="col-md-6">
                            <label for="ex4" class="col-md-5"><b>LastUpdatedDate:</b></label>
                            @Html.TextBoxFor(m => m.LastUpdatedDate, new { @class = "col-md-6", disabled = "disabled", @readonly = "readonly" })
                        </div>
                    </div>
                </div>

            </form>
            <div style="float: right; padding-right: 50px">
                <input type="submit" name="submit" value="Save" class="btn btn-primary btn-md" />
                <button class="btn btn-primary btn-md" role="button" data-dismiss="modal" aria-hidden="true">Close</button>
            </div>
        </div>
    }
</div>
<script>
    function displayMessage(response) {
        if (response == '' || response == 0) {
            location.reload();
        } else {
            alert(response);
        }
    }
</script>
<style>
    .modal-body {
        padding: 5px;
    }
</style>
